﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace HiLand.Utility.Setting
{
    public class Config
    {
        #region 数据库连接字符串
        /// <summary>
        /// 获取缺省的数据库连接字符串
        /// </summary>
        public static string ConnectionString
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }
        }

        /// <summary>
        /// 获取某个指定名称的数据库连接字符串
        /// </summary>
        /// <param name="connectionStringName"></param>
        /// <returns></returns>
        public static string GetConnectionString(string connectionStringName)
        {
            return ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
        }
        #endregion


        #region 配置节点读取
        /// <summary>
        /// 读取配置节点
        /// </summary>
        /// <param name="settingName"></param>
        /// <returns></returns>
        public static string GetAppSetting(string settingName)
        {
            return ConfigurationManager.AppSettings[settingName];
        }
        #endregion
    }
}
